<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>定时任务日志</title>
	<meta name="decorator" content="default"/>
	<%@ include file="/WEB-INF/views/include/bootstrap-table.jsp"%>
</head>

<body>
	<div class="boxcontent clearfix">
		<div class="content clearfix" style="margin: 0;">
			<form id="searchForm"  class="form-search">
				<div class="search-bar">
		          <ul class="clearfix">
		                  <input id="jobId" name="jobId" value="${param.id}" type="hidden">
			              <li>
			              <span>spring bean名称：</span>
			              <input id="beanName" name="beanName" class="form-control bootstrap-table-input"/>
						 </li>
			              <li>
			              <span>方法名：</span>
			              <input id="methodName" name="methodName" class="form-control bootstrap-table-input"/>
						 </li>
			              <li>
			              <span>任务状态：</span>
			              <select id="status" name="status">
				                 <option value="">请选择</option>
				                 <option value="0">成功</foption>
				                 <option value="1">失败</option>
			              </select>
						 </li>
						</ul>
					<div id="btn_search" class="search-btn">查询</div>
					<script type="text/javascript">
						$(function(){
							$(".search-bar ul li").each(function(){
								var spanWidth = $(this).find("span").width();
								$(this).find(".form-control").width(230-20-spanWidth);	
								$(this).children(".input-append").find(".required").width(230-20-36+1-spanWidth);	
								var barHeight = $(".search-bar").height();
								$(".search-btn").css("line-height", barHeight+"px");
							});
						})
					</script>
				</div>
				
				<div id="toolbar">
				</div>
			</form>
			
		<div class="tbbox firsttdCenter">
		
	    <table id="table" 
	         data-toggle="table" 
	         data-url="${ctx}/job/scheduleJobLog/scheduleJobLogListJson"
	         data-toolbar="#toolbar"
		     data-height="${dataHeight491}" 
		     data-maintain-selected="true" 
		     data-side-pagination="server"
		     data-click-to-select="true" 
		     data-pagination="true" 
		     data-single-select="false"
		     data-id-field="id"
		     data-query-params="doQuery"
		     data-cache="false"
		     data-show-columns="true"
		     data-page-list="${dataPageList}">
		<thead>
			<tr>
		    	<!-- 属性 data-visible="false" 可以隐藏列 -->
		    	<!-- 属性data-sortable="true" 可以列排序 -->
				<th data-checkbox="true"></th>
					   <th data-field="jobId"  data-visible="false">任务id</th>
					   <th data-field="beanName">spring bean名称</th>
					   <th data-field="methodName">方法名</th>
					   <th data-field="params">参数</th>
					   <th data-field="status" data-formatter="statusFormatter" >任务状态</th>
					   <th data-field="error">失败信息</th>
					   <th data-field="times">耗时(单位：毫秒)</th>
					   <th data-field="updateDate" data-sortable="true">更新时间</th>
			</tr>
		</thead>
	    </table>
	    </div>
	</div>
	
	<script type="text/javascript">
	  var $table = $('#table');
	  $(function () { 
          
	      $("#btn_search").click(function () { 
	              $table.bootstrapTable('refresh'); 
	       }); 
	   }); 
	  
	  //查询函数
	  function doQuery(params) {
           	 var jobId = $("#jobId").val();
			 if(jobId != null && jobId !=''){
				params.jobId = jobId;
			 }
			 
           	 var beanName = $("#beanName").val();
			 if(beanName != null && beanName !=''){
				params.beanName = beanName;
			 }
			 
           	 var methodName = $("#methodName").val();
			 if(methodName != null && methodName !=''){
				params.methodName = methodName;
			 }
			 
           	 var status = $("#status").val();
			 if(status != null && status !=''){
				params.status = status;
			 }
			 
		    return params;
	}
	  
	function statusFormatter(value, row){
			//0：正常   1：暂停
			if(value == "0"){
				return "成功";
			}else{
				return "失败";
			}
		}
	
	/**
	*  操作项  add for lgx  提供查看，修改，删除按钮，如果还有系统按钮，
	*  比如禁用，可在子页面进行自定义函数添加（建议列表操作项按钮不要超过5个）
	*/
	function operationFormatter(value, row){
		
		//var params = "id="+value;
		//查看
		//var html = '<a href="javascript:void(0);" style="padding-right:5px;" onclick="detail(\'job/scheduleJobLog/scheduleJobLogDetail\',\'查看定时任务日志信息\',\''+params+'\')">查看</a>';
		//修改
		//html = html + '<a href="javascript:void(0);" style="padding-right:5px;" onclick="modify(\'job/scheduleJobLog/scheduleJobLogForm\',\'修改定时任务日志信息\',\''+params+'\')">修改</a>';
		//删除
		//html= html  + '<a href="javascript:void(0);" onclick="deleteData(\'job/scheduleJobLog/deleteAjax\',\'是否删除数据？\',\''+params+'\')">删除</a>';
		
		return value;
	}  
	</script>
	
	<jsp:include page="/WEB-INF/views/include/pageJs.jsp" />
</body>

</html>